Some programming languages or environments control the memory allocation directly and do not allow a user to control the memory allocation. Languages which handle memory allocation on behalf of a user suffer from a high level of abstraction. For example, MATLAB® allocates a block of memory and stores data in the block when a user assigns data type (a numeric, string, or structure array, for example) to a variable. In MATLAB®, memory allocation is not controlled by the user, and hence it is difficult for the user to know how much memory is being allocated and used.
Other programming languages or environments allow a user to control the memory allocation. For example, C enables a user to allocate memory for a program. The most common problems with languages that allow a user to control memory are memory leaks and memory overwrites. Leaks happen when the user forgets to explicitly free memory that they had allocated earlier. This causes the program to run out of memory. Memory overwrites happen when the user is allowed to write data into freed memory or write past the end of a block. These usually cause the program to crash or behave in unexpected ways. So, memory debugging tools for these types of languages normally provide ways to track memory leaks (unfreed memory) or memory overwrites.
C++ has properties of both types of languages. Standard C++ offers very little abstraction for memory management and when used this way it suffers from memory leaks and overwrites. But, C++ provides constructs to abstract away memory management which then makes C++ more like MATLAB®. The abstraction of the memory allocation makes it difficult for the user to recognize the memory usage patterns in the program. If a program runs out of memory or starts to use so much memory that the performance degrades, it is very difficult to track down what code is actually causing the problem.
Most operating systems have some kind of task manager or operating system calls to query overall memory usage. The operating systems do not provide memory usage information that ties back to sections of the original program.